package xyz.paragon.review.controller;

import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import xyz.paragon.review.persistence.domain.Review;
import xyz.paragon.review.persistence.service.ReviewService;

@RestController
public class ReviewController {

    private final ReviewService reviewService;

    public ReviewController(ReviewService reviewService) {
        this.reviewService = reviewService;
    }

    @GetMapping(value = "")
    public ResponseEntity<?> findAll() {

        Iterable<Review> reviews = reviewService.findAll();

        return ResponseEntity.ok(reviews);
    }

}
